using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using Entities;
using BUS;


public partial class Admin_SanPham_CapNhatPhuongThucThanhToan : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            LoadData();
        }

    }

    #region"LoadData"
    private void LoadData()
    {
        int id = int.Parse(Request.QueryString["id"]);
        tbPhuongThucThanhToan phuongthuc = tbPhuongThucThanhToanBUS.GetByID(id);
        txt_MaPT.Text = phuongthuc.MaPT.ToString();
        txt_TenPT.Text = phuongthuc.TenPT;       
    }
    #endregion
    protected void btn_Add_Click(object sender, EventArgs e)
    {
        try
        {
            tbPhuongThucThanhToan phuongthuc = new tbPhuongThucThanhToan();
            int id = int.Parse(Request.QueryString["id"]);
            phuongthuc.MaPT = id;
            phuongthuc.TenPT = txt_TenPT.Text;
            tbPhuongThucThanhToanBUS.Update(phuongthuc);
        }
        catch
        {
            Response.Redirect("~/Admin/SanPham/DanhSachPhuongThucThanhToan.aspx");
        }
        Response.Redirect("~/Admin/SanPham/DanhSachPhuongThucThanhToan.aspx");
    }
}
